package com.cheyun.netsalev3.widget

import android.content.Context
import android.util.AttributeSet
import androidx.recyclerview.widget.RecyclerView

class MyRecyclerView : RecyclerView {
    constructor(context: Context) : super(context)

    constructor(context: Context, attrs: AttributeSet) : super(context, attrs)

    override fun setTranslationY(translationY: Float) {
        function?.invoke(translationY)
        super.setTranslationY(translationY)
    }

    private var function: ((Float) -> Unit)? = null

    fun addOnOffsetChangedListener(function: (translationY: Float) -> Unit) {
        this.function = function
    }
}